<?php

$senderemail=$_POST['email'];
$receiveremail=$_POST['receiveremail'];
$namn=$_POST['namn'];
$angaende=$_POST['angaende'];
$meddelande=$_POST['meddelande'];
$anvandarnamn=$_POST['anvandarnamn'];

$to      = $receiveremail;
$subject = $angaende;
$message = $meddelande;

// To send HTML mail, the Content-type header must be set
$headers  = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset= UTF-8" . "\r\n";

// Additional headers
$headers .= "From: $senderemail";


 if (mail($to, $subject, $meddelande, $headers)) {
   echo("<p>Message successfully sent!</p>");
   header("Location: ../getProfile/getProfile.php?profileName=$anvandarnamn&cmejl=1");

  } else {
   echo("<p>Message delivery failed...</p>");
   header("Location: ../getProfile/getProfile.php?profileName=$anvandarnamn&cmejl=2");}


?>
